import { createRouter, createWebHashHistory } from "vue-router"

//路由地址
const routes=[
    {
        path: '/',
        name: 'login',
        component: ()=> import('../views/login.vue'),
        meta: {name:'login'}
    },
    {
        path: '/admin',
        name: 'admin',
        component: ()=> import('../views/admin/index.vue'),
        children:[
            {
                path: '/room',
                name: 'room',
                component: ()=> import('../views/admin/room.vue'),
                meta: {name:'room'}
            }
        ]
    },
   {
        path: '/register',
        name: 'register',
        component: ()=> import('../views/register.vue'),
        meta: {name:'register'}
    },
    {
        path: '/mybooking',
        name: 'mybooking',
        component: ()=> import('../views/member/mybooking.vue'),
        meta: {name:'mybooking'}
    },
    {
        path: '/bookingroom',
        name: 'bookingroom',
        component: ()=> import('../views/member/room.vue'),
        meta: {name:'bookingroom'}
    }
    
]

//创建路由
const router = createRouter({
    history: createWebHashHistory(),
    routes
})

//路由守卫
router.beforeEach((to,from,next)=>{
    next()
})

export default router